﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MakeString
{
    class MakeString
    {
        static CultureInfo currentCulture = CultureInfo.CurrentCulture;

        static void Main()
        {
            // Loops 1 through 4 violate this rule.
            Loop1();
            Loop2();
            Loop3();
            Loop4();
            Loop5();
        }

        static void Loop1()
        {
            string digits = string.Empty;
            for (int i = 0; i < 10; i++)
            {
                digits = String.Concat(digits, i.ToString(currentCulture));
            }
            Console.WriteLine(digits);
        }

        // This method violates the rule but 
        // the violation should be excluded.
        static void Loop2()
        {
            string digits = string.Empty;
            for (int i = 0; i < 10; i++)
            {
                digits = String.Concat(digits, i.ToString(currentCulture));
                Console.WriteLine(digits);
            }
            Console.WriteLine("ma " + digits);
        }

        static void Loop3()
        {
            string digits = string.Empty;
            for (int i = 0; i < 10; i++)
            {
                digits = digits + i.ToString(currentCulture);
            }
            Console.WriteLine(digits);
        }

        static void Loop4()
        {
            string digits = string.Empty;
            for (int i = 0; i < 10; i++)
            {
                digits += i.ToString(currentCulture);
            }
            Console.WriteLine(digits);
        }

        // This method does not cause a violation of the rule.
        static void Loop5()
        {
            StringBuilder digits = new StringBuilder();
            for (int i = 0; i < 10; i++)
            {
                digits.Append(i.ToString(currentCulture));
            }
            Console.WriteLine(digits.ToString());
        }
    }
}
